﻿@model ThaireInvestmentWeb.WcfSerivce.UnitTrustHeaderDTO   
@{
    Layout = null;
}
<script>
    $(document).ready(function () {
        $("#historyOfParDialog").dialog({
            width: 500,
            autoOpen: false,
            modal: true,
            position: ['center', 100],
            buttons: {
                close: function () {
                    $(this).dialog("close");
                }
            }
        });
        $("#historyOfBidOrNavDialog").dialog({
            width: 500,
            autoOpen: false,
            modal: true,
            position: ['center', 100],
            buttons: {
                close: function () {
                    $(this).dialog("close");
                }
            }
        });
        $("#historyOfParDialog").parent().children().children('.ui-dialog-titlebar-close').hide();
        $("#historyOfBidOrNavDialog").parent().children().children('.ui-dialog-titlebar-close').hide();

        changeListedStatus($("#Header_ListedStatus").val());
        @*if ($("#UpdateMode").val() == '' || $("#UpdateMode").val().toLowerCase() == 'false' || 'true' != '@ViewBag.UpdateMode'.toLowerCase())
            $("#btnProportion").hide();
        if ( 'true' == '@ViewBag.UpdateMode'.toLowerCase())
            $("#btnProportion").show();*@       
    });

    function openParHistory() {
        $("#historyOfParDialog").dialog('option', 'title', 'Par Histories');
        $("#historyOfParDialog").dialog('open');
    }
    function openhistoryOfBidOrNavHistory() {
        $("#historyOfBidOrNavDialog").dialog('option', 'title', 'Bid or Nav Histories');
        $("#historyOfBidOrNavDialog").dialog('open');
    }
    function changeListedStatus(value) {
        //alert("test" + value);
        if (value != '' && value != null) {
            if (value == 'LISTED') {
                $('#lblBidOrNav').text('Bid Price');
                $('#lblBidOrNavAsOF').text('Bid Price as of');
            }
            else {
                $('#lblBidOrNav').text('NAV');
                $('#lblBidOrNavAsOF').text('NAV as of');
            }
        }
    }
</script>
<div id="historyOfParDialog" style="display: none">
    @if (Model != null)
    {
        @Html.Partial("_UnitTrustParView", Model)
    }
    else
    {
        <label>Data not found.</label>
    }
</div>
<div id="historyOfBidOrNavDialog" style="display: none">
    @if (Model != null && Model != null)
    {
        @Html.Partial("_UnitTrustBidOrNavView", Model)
    }
    else
    {
        <label>Data not found.</label>
    }
</div>

<table class="tableform" width="100%" border="5" align="center" cellspacing="2">
    <tr>
        <td width="300" height="31">&nbsp;</td>
        <td align="right">
            <div style="text-align: right">Create by : @Model.Header.CreateBY </div>
        </td>
        <td width="5">&nbsp;</td>
        <td width="139" align="right">
            <div style="text-align: right">Create Time :@Model.Header.CreateDate</div>
        </td>
    </tr>
    <tr>
        <td width="300" height="31">&nbsp;</td>
        <td align="right">
            <div style="text-align: right">Update by : @Model.Header.ModifyBY</div>
        </td>
        <td width="5">&nbsp;</td>
        <td width="139" align="right">
            <div style="text-align: right">Update Time :@Model.Header.ModifyDate</div>
        </td>
    </tr>
</table>
<table class="tableform" width="100%" border="5" align="center" cellspacing="2">
    <tr>
        <td width="212">
            <div align="right">Company Name <span class="error">*</span> : </div>
        </td>
        <td>&nbsp;</td>
        <td style="width: 236px">@Html.TextBoxFor(model => model.Header.UnitTrustCompanyName, new { @readonly = "readonly" , style = "width:320px"})</td>
        <td width="188" align="right">
            <div align="right">Maturity Status:</div>
        </td>
        <td>&nbsp;</td>
        <td width="208">
            @Html.TextBoxFor(model => model.Header.MaturityStatus, new { @readonly = "readonly" })
            @*<table width="71%" border="0" cellspacing="1" bgcolor="#000000">
                <tr>
                    <td bgcolor="#FFFFFF"></td>
                </tr>
            </table>*@
        </td>
    </tr>
    <tr>
        <td>
            <div align="right">Type : </div>
        </td>
        <td>&nbsp;</td>
        <td style="width: 236px">@Html.TextBoxFor(model => model.Header.UnitTrustTypeName, new { @readonly = "readonly", style = "width:320px" })</td>
        <td>
            <div align="right">Group of Type : </div>
        </td>
        <td>&nbsp;</td>
        <td style="width: 236px">
            @Html.TextBoxFor(model => model.Header.UnitTrustTypeGroup, new { @readonly = "readonly" })</td>
    </tr>
    <tr>
        <td>
            <div align="right">
                Fund Name(TH) <span class="error">*</span>
                :
            </div>
        </td>
        <td>&nbsp;</td>
        <td style="width: 236px">
            @Html.TextBoxFor(model => model.Header.FundName, new { @readonly = "readonly", style = "width:320px" })</td>
        <td>
            <div align="right"></div>
        </td>
        <td>&nbsp;</td>
        <td>

        </td>
    </tr>
    <tr>
        <td>
            <div align="right">
                Fund Name(EN) <span class="error">*</span>
                :
            </div>
        </td>
        <td>&nbsp;</td>
        <td style="width: 236px">
            @Html.TextBoxFor(model => model.Header.FundNameEn, new { @readonly = "readonly", style = "width:320px" })</td>
        <td></td>
        <td>&nbsp;</td>
        <td></td>
    </tr>
    <tr>
        <td style="height: 4px"></td>
        <td style="height: 4px"></td>
        <td style="width: 236px; height: 4px;"></td>
        <td style="height: 4px"></td>
        <td style="height: 4px"></td>
        <td style="height: 4px"></td>
    </tr>
    <tr>
        <td>
            <div align="right">
                Asset Management <span class="error">*</span>
                :
            </div>
        </td>
        <td>&nbsp;</td>
        <td style="width: 236px">
            @Html.TextBoxFor(model => model.Header.AssetMgmtName, new { @readonly = "readonly", style = "width:320px" })
        </td>
        <td><div align="right">Listed Status : </div></td>
        <td> &nbsp;</td>
        <td>
            @Html.TextBoxFor(model => model.Header.ListedStatus, new { @readonly = "readonly" })</td>
    </tr>
    <tr>
        <td>
            <div align="right">
                Symbol <span class="error">*</span>
                :
            </div>
        </td>
        <td>&nbsp;</td>
        <td style="width: 236px">
            @Html.TextBoxFor(model => model.Header.Symbol, new { @readonly = "readonly"})

        </td>
        <td>
            <div align="right">Total size : </div>
        </td>
        <td>&nbsp;</td>
        <td>

            @Html.TextBoxFor(model => model.Header.TotalSize, new {  style = "width: 120px;",@readonly = "readonly", @Value = ThaireInvestmentWeb.Util.WebUtil.FormatDecimal2DigitFree(@Model.Header.TotalSize)})


        </td>
    </tr>
    <tr>
        <td>
            <div align="right">Maturity Date  : </div>
        </td>
        <td>&nbsp;</td>
        <td style="width: 236px">
            @Html.TextBoxFor(model => model.Header.MaturityDate, new { @readonly = "readonly", @Value = ThaireInvestmentWeb.Util.WebUtil.FormatDate(@Model.Header.MaturityDate) })

        </td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>
                            <input type="button" id="btnProportion" name="btnProportion" value="สัดส่วนการลงทุน " class="button" onclick="go('@Url.Action("EditUnitTrustProportion", "UnitTrust", new { headerId = Model.Header.ID.ToString() })    ');">

        </td>
    </tr>
    <tr>
        <td>
            <div align="right">
                <label id="lblBidOrNav" name="lblBidOrNav">Bid Price / NAV :</label>
            </div>
        </td>
        <td>&nbsp;</td>
        <td style="width: 236px">
            @Html.TextBoxFor(model => model.Header.BidPrice, new { @readonly = "readonly", @class = "inputNumberField" ,@Value = ThaireInvestmentWeb.Util.WebUtil.FormatCurrency2(@Model.Header.BidPrice) })
            <input type="button" name="Submit23" value=" history " class="button" onclick="openhistoryOfBidOrNavHistory(); return false;">
        </td>
        <td style="height: 4px">
            <div align="right">Initial Par : </div>
        </td>
        <td style="height: 4px"></td>
        <td style="width: 236px; height: 4px;">
            @Html.TextBoxFor(model => model.Header.InitialPar, new { style = "width: 120px;", @readonly = "readonly", @class = "inputNumberField" ,@Value = ThaireInvestmentWeb.Util.WebUtil.FormatCurrency2(@Model.Header.InitialPar) })
        </td>
    </tr>
    <tr>
        <td style="height: 4px">
            <div align="right">
                <label id="lblBidOrNavAsOF" name="lblBidOrNavAsOF">Bid Price as of / NAV as of</label>
            </div>
        </td>
        <td style="height: 4px">&nbsp;</td>
        <td style="width: 236px; height: 4px;">
            @Html.TextBoxFor(model => model.Header.BidPriceDate, new { @readonly = "readonly", @Value = ThaireInvestmentWeb.Util.WebUtil.FormatDate(@Model.Header.BidPriceDate) })
        </td>
        <td style="height: 4px">
            <div align="right">Par : </div>
        </td>
        <td style="height: 4px"></td>
        <td style="width: 236px; height: 4px;">
            @Html.TextBoxFor(model => model.Header.Par, new { style = "width: 120px;", @readonly = "readonly", @class = "inputNumberField" ,@Value = ThaireInvestmentWeb.Util.WebUtil.FormatCurrency2(@Model.Header.Par) })
            <input type="button" name="Submit25" value=" history " class="button" onclick="openParHistory(); return false;">
        </td>
    </tr>
    <tr>
        <td style="height: 4px">
            @*<div align="right">Cost NAV   : </div>*@
        </td>
        <td style="height: 4px"></td>
        <td style="width: 236px; height: 4px;">
            </td>
        <td style="height: 4px">
            <div align="right">Par as of   : </div>
        </td>
        <td style="height: 4px">&nbsp;</td>
        <td style="width: 236px; height: 4px;">
            @Html.TextBoxFor(model => model.Header.ParDate, new { @readonly = "readonly", @Value = ThaireInvestmentWeb.Util.WebUtil.FormatDate(@Model.Header.ParDate) })
        </td>
    </tr>
    <tr>
        <td>
            <div align="right">Low Liquidity    : </div>
        </td>
        <td>&nbsp;</td>
        <td colspan="4">Tier I&nbsp; 
            @Html.TextBoxFor(model => model.Header.LiquidityTierIPercent, new { @readonly = "readonly" })
            %
            <br />
            Tier II&nbsp;
            @Html.TextBoxFor(model => model.Header.LiquidityTierIIPercent, new { @readonly = "readonly" })
            %
            <br />    
            Low Liquidity&nbsp;
            @Html.TextBoxFor(model => model.Header.LiquidityLowLiquidityPercent, new { @readonly = "readonly" })
            %
            <br />
        </td>
    </tr>
    <tr>
        <td>
            <div align="right">Involved Party Type Name    : </div>
        </td>
        <td>&nbsp;</td>
        <td style="width: 236px">
            @Html.TextBoxFor(model => model.Header.InvolvedPartyTypeName, new { @readonly = "readonly", style = "width:320px"})
            &nbsp;</td>
        <td>
            <div align="right">Involved Party Type No. : </div>
        </td>
        <td>&nbsp;</td>
        <td>
            @Html.TextBoxFor(model => model.Header.InvolvedPartyTypeID, new { @readonly = "readonly" })

        </td>
    </tr>

    <tr>
        <td>
            <div align="right">Relate    : </div>
        </td>
        <td>&nbsp;</td>
        <td style="width: 236px">

            @Html.TextBoxFor(model => model.Header.Related, new { @readonly = "readonly" })

        </td>
        <td>
            <div align="right">Remark (OIC)    : </div>
        </td>
        <td>&nbsp;</td>
        <td>@Html.TextBoxFor(model => model.Header.RemarkOic, new { @readonly = "readonly" })
            %</td>
    </tr>
</table>
